using System;
using System.Collections.Generic;
using System.Text;
using AllegNet;

namespace DemonHunter
{
    class BackgroundCows:Entity
    {
                //data
        private static Bmp run1Bmp;
        private static Bmp run2Bmp;
        private double animationIndex;
        //constructor
        public BackgroundCows()
        {
            entityYLoc = 250;
            entityXLoc = Logic.GetInstance().GetXLoc() - run1Bmp.Width;

        }
        //overridden functions
        //don't allow ai to move cow
        public override void move() 
        { 
            entityXLoc += 4 * speedModifier;
            if (entityXLoc > Logic.GetInstance().GetXLoc() + 1024) Level.GetInstance().RemoveEntity(this);
        }

        /// <summary>
        /// not necessary
        /// </summary>
        public override void animate()
        {
            animationIndex += .05 * speedModifier;
            if (animationIndex > 2) animationIndex = 0;
        }
        /// <summary>
        /// return current bitmap
        /// if animation index has no remainder then it is even and should display
        /// first bitmap, otherwise it should display second bitmap
        /// </summary>
        /// <returns></returns>
        public override Bmp GetCurrentBitmap()
        {
            if (animationIndex < 1)
            {
                return run1Bmp;
            }
            else
            {
                return run2Bmp;
            }
        }
        /// <summary>
        /// load bitmaps into memory
        /// </summary>
        public new static void LoadBitmaps()
        {
            run1Bmp = Game.GetInstance().LoadBitmap("C:\\DemonHunterart\\props\\cowsRun1.bmp");
            run2Bmp = Game.GetInstance().LoadBitmap("C:\\DemonHunterart\\props\\cowsRun2.bmp");
        }
        /// <summary>
        /// return current bitmap height
        /// </summary>
        /// <returns></returns>
        public override double GetCurrentBitmapHeight()
        {
            return -1.0;
        }
    }
}
